{include file="public/header" /}
<body class="gray-bg">
<div class="wrapper wrapper-content">
    <div class="row">
        <div class="col-sm-3">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <span class="label label-success pull-right">元</span>
                    <h5>商家</h5>
                </div>
                <div class="ibox-content">
                    <h1 class="no-margins" >{$shop}</h1>
                    <small>商家已提现总额</small>
                </div>
            </div>
        </div>
        <div class="col-sm-3">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <span class="label label-success pull-right">元</span>
                    <h5>上月</h5>
                </div>
                <div class="ibox-content">
                    <h1 class="no-margins" >{$month}</h1>
                    <small>上月提现总额</small>
                </div>
            </div>
        </div>
        <div class="col-sm-3">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <span class="label label-success pull-right">元</span>
                    <h5>今日</h5>
                </div>
                <div class="ibox-content">
                    <h1 class="no-margins" >{$today}</h1>
                    <small>今日提现总额</small>
                </div>
            </div>
        </div>
        <div class="col-sm-3">
            <div class="ibox float-e-margins">
                <div class="ibox-title">
                    <span class="label label-success pull-right">元</span>
                    <h5>昨日</h5>
                </div>
                <div class="ibox-content">
                    <h1 class="no-margins" >{$yesterday}</h1>
                    <small>昨日提现总额</small>
                </div>
            </div>
        </div>
    </div>
    <div class="ibox float-e-margins">
        <div class="ibox-content">
            <div class="row">
                <!--搜索框开始-->
                <div class="col-sm-12">
                    <div class="layui-form layui-form-item">
                        <div class="layui-input-inline layui-form">
                            <select name="role" lay-search="">
                                <option  value="">不限机构</option>
                                <option  value="1">支付宝</option>
                                <option  value="2">微信</option>
                            </select>
                        </div>
                        <div class="layui-col-md6 layui-input-inline">
                            <input type="text" id="key" class="layui-input search" name="key" value="" placeholder="订单号/账户"/>
                        </div>
                        <div class="layui-input-inline">
                            <button class="layui-btn" lay-submit="" lay-filter="LAY-search">立即搜索</button>
                            <button  class="layui-btn layui-btn-normal" id="empty"  lay-submit="" lay-filter="LAY-search">重置</button>
                        </div>
                    </div>
                </div>
                <!--搜索框结束-->
            </div>
            <div class="hr-line-dashed"></div>

            <div class="example-wrap">
                <div class="example">
                    <table class="layui-hide" id="test" lay-filter="demo"></table>
                    <script type="text/html" id="whoTpl">
                        {{# if(d.o_user_id){ }}
                            {{d.user_username}}
                        {{# }else{ }}
                            {{d.shop_name}}
                        {{# } }}
                    </script>
                    <script type="text/html" id="titleTpl">
                        {{# if(d.o_user_id){ }}
                            用户
                        {{# }else{ }}
                            商户
                        {{# } }}
                    </script>
                    <script type="text/html" id="typeTpl">
                        {{# if(d.o_pay_type == 1){ }}
                        支付宝
                        {{# }else{ }}
                        微信
                        {{# } }}
                    </script>
                    <script type="text/html" id="staTpl">
                        {{# if(d.o_tixian_status == 1){ }}
                        待审核
                        {{# }else if(d.o_tixian_status == 2){ }}
                        提现成功
                        {{# }else if(d.o_tixian_status == 3){ }}
                        提现失败
                        {{# }else if(d.o_tixian_status == 4){ }}
                        驳回
                        {{# } }}
                    </script>
                    <!--操作模板-->
                    <!-- <script type="text/html" id="opeBar"> -->
                        <!-- {{# if(d.o_tixian_status==1){ }} -->
                        <!-- <a href="javascript:;" onclick="check('{{d.o_id}}')" class="btn btn-primary btn-xs m-r-xs">审核</a> -->
                        <!-- {{# } }} -->
                    <!-- </script> -->
                </div>
            </div>
        </div>
    </div>
</div>
{include file="public/footer" /}
<script>
    //layui渲染数据表格
    layui.use('table', function () {
        var table = layui.table
            , form = layui.form;
        table.render({
            elem: '#test'
            , url: '{:url("money/get")}'
            ,response: {
                statusCode: 220 //成功的状态码，默认：0
            }
            , page: true
            , size: 'lg' //sm小尺寸的表格 lg大尺寸
            , cellMinWidth: 150
            , limits: [5, 10, 15, 20, 25, 30]
            , limit: "{:config('pages')}"
            , loading: true
            , id: 'testReload'
            , cols: [[
                {type:'numbers', width: 80, title: '序号'}
                , {width: '', title: '身份', align: 'center',templet:"#titleTpl"}
                , {width: '', title: '提现人', align: 'center',templet:"#whoTpl"}
                , {field: 'o_order_num',width: '', title: '订单号', align: 'center'}
                , {field: 'o_real_name',width: '', title: '真实姓名', align: 'center'}
                , {field: 'o_money', width: '', title: '金额', align: 'center'}
                , {field: 'o_account', width: '', title: '账户', align: 'center'}
                , {field: 'o_pay_type', width: '', title: '提现类型', align: 'center',templet:"#typeTpl"}
                , {field: 'o_tixian_status', width: '', title: '提现状态', align: 'center',templet:"#staTpl"}
                , {field: 'o_add_time', width: '', title: '时间', align: 'center'}
                //, {fixed: 'right', width: 100, title: '操作', align: 'center', toolbar: '#opeBar'}
            ]]
        });
    });
    function check(o_id) {
        layer.confirm('提现审核是否通过?', {
            icon: 3,
            title:'提示',
            btn: ['通过', '驳回'],
            btn2:function(index){
                send(o_id,4);
                layer.close(index);
            }}, function(index){
            send(o_id,2);
            layer.close(index);
        });
    }
    function send(o_id,type){
        $.ajax({
            url: "{:url('tixian')}",
            type: "post",
            dataType: "json",
            data: {o_id:o_id,type:type},
            success: function (res) {
                if(res.code == 200){
                    layer.msg(res.msg,{icon:1,time:1500,shade: 0.1},function(){
                        //重载当前页表格
                        $(".layui-laypage-btn").click();
                    });
                } else if (res.code == 100){
                    layer.msg(res.msg,{icon:2,time:1500,shade: 0.1},function () {
                        //重载当前页表格
                        $(".layui-laypage-btn").click();
                    });
                }
            }
        });
    }
</script>
</body>
</html>